package com.zhanghe.study.springcloudalibaba.service;

import com.zhanghe.study.springcloudalibaba.dao.AccountDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.concurrent.TimeUnit;

/**
 * @author zh
 * @date 2021/9/15 16:14
 */
@Service
public class AccountService {

    @Autowired
    private AccountDao accountDao;

    public void decrease(int userId, double money) throws InterruptedException {
        System.out.println("账户扣减开始");
        TimeUnit.SECONDS.sleep(10);
        accountDao.decrease(userId, money);
        System.out.println("账户扣减结束");
    }
}
